<?php



/**
 * Skeleton subclass for performing query and update operations on the 'users' table.
 *
 *
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    propel.generator.rcp
 */
class RcpUsersQuery extends RcpBaseUsersQuery
{
	
	public function addBaseData() {
		$this
      ->useUserRolesQuery(null, Criteria::LEFT_JOIN)
      	->leftJoinRoles()
			->endUse()
			->leftJoinPositions()
      ->leftJoinUnits()
			->with('UserRoles')
			->with('Roles')
			->with('Units')
			->with('Positions');
		return $this;
	}
	
	public function findOneByIdWithBaseData($id) {
		return $this
		->addBaseData()
		->findById($id)
		->getFirst();
	}
	
	public function findOneByLoginDataWithBaseData($email, $password) {
		return $this
		->addBaseData()
		->filterByEmail($email)
		->filterByPassword($password)
		->find()
		->getFirst();
	}
	
}
